package dtrs.corba.server.semaphores;


import dtrs.corba.server.common.ShowDTO;


public class ManageFileSemaphore extends Thread{
	
	 private ReserveFile reserveFile;
	 private int action;
	 
	 public ShowDTO showiFile;
	 
	 
	 public ManageFileSemaphore (ReserveFile rf, int actionP){
		 rf.setBound(1);
		 this.reserveFile =rf;
		 this.action = actionP;
		 showiFile = null;
	 }	
	 
	 
	 public ManageFileSemaphore (ReserveFile reFileP, int actionP, ShowDTO showFileP){
		 reFileP.setBound(1);
		 this.reserveFile = reFileP;
		 this.action = actionP;
		 this.showiFile = showFileP;
	 }
	 
	public void run() {
		try{			
			reserveFile.getInformationReadWrite(this.action, this.showiFile);
		}finally{
			reserveFile.releaseFile();
		}

	}

	//get the object in case to check the tickets already reserved
	public ShowDTO getShowiFile() {
		return showiFile;
	}
	
	
}





